{% extends 'framework.html' %}
{% load bootstrap3 %}
{% load static %}

{% block subject %}我的文件{% endblock %}

{% block content %}
<div class="panel panel-default">
 <div class="panel-heading">我的文件</div>
 <div class="panel-body">
    <form role="form" method="post" enctype="multipart/form-data">
       {% for field in form %}
           {% if field.name == 'is_markdown' %}
             {% bootstrap_field field field_class='checkbox c-checkbox needsclick' %}
           {% elif field.name == 'filename' %}
             {% bootstrap_field field addon_after='<button type="button" class="btn btn-default generate">随机生成</button>' addon_after_class='input-group-btn' %}
           {% else %}
             {% bootstrap_field field %}
           {% endif %}
       {% endfor %}

        <button type="submit" name="sat" class="mb-sm btn btn-success">提交并返回</button>
        <button type="submit" name="sae" class="mb-sm btn btn-success">提交并继续编辑</button>
        <a type="button" class="mb-sm btn btn-default" href="{{ request.session.back_url }}">返回</a>

       {% csrf_token %}
    </form>

 </div>
</div>
{% endblock %}

{% block addscript %}
<script src="{% static 'vendor/bootstrap-filestyle/src/bootstrap-filestyle.js' %}"></script>
<script src="https://cdn.jsdelivr.net/gh/devbridge/jQuery-Autocomplete@1.4.9/dist/jquery.autocomplete.min.js"></script>
{{ js_config|json_script:"js_config" }}
<script src="{% static 'note/note.min.js' %}"></script>
{% endblock %}

{% block addstyle %}
<link rel="stylesheet" href="{% static 'note/note.min.css' %}">
<style type="text/css">
.autocomplete-suggestions { border: 1px solid #999; background: #FFF; overflow: auto; }
.autocomplete-suggestion { padding: 2px 5px; white-space: nowrap; overflow: hidden; }
.autocomplete-selected { background: #F0F0F0; }
.autocomplete-suggestions strong { font-weight: normal; color: #3399FF; }
.autocomplete-group { padding: 2px 5px; }
.autocomplete-group strong { display: block; border-bottom: 1px solid #000; }
.CodeMirror-scroll {min-height: 300px}
.CodeMirror {  border: 1px solid #eee;  height: auto;  }
#editor-wrapper { height: 300px; width: 100%; }
</style>
{% endblock %}